home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 92 / CDMM92_1.ISO / SOF 2 SDK / sof2sdk-101.msi / _92D6AC311BB48EBA344BBABC89DA6AB0 / _96AF066145D6409AB3A8C3545350E34D < prev    next >
Encoding:
Text File  |  2002-06-05  |  3.7 KB  |  98 lines

  1. // Copyright (C) 2001-2002 Raven Software
  2. //
  3. /*****************************************************************************
  4.  * name:        be_ai_chat.h
  5.  *
  6.  * desc:        char AI
  7.  *
  8.  * $Archive: /source/code/botlib/be_ai_chat.h $
  9.  * $Author: Mrelusive $ 
  10.  * $Revision: 2 $
  11.  * $Modtime: 10/05/99 3:32p $
  12.  * $Date: 10/05/99 3:42p $
  13.  *
  14.  *****************************************************************************/
  15.  
  16. #define MAX_MESSAGE_SIZE        256
  17. #define MAX_CHATTYPE_NAME        32
  18. #define MAX_MATCHVARIABLES        8
  19.  
  20. #define CHAT_GENDERLESS            0
  21. #define CHAT_GENDERFEMALE        1
  22. #define CHAT_GENDERMALE            2
  23.  
  24. #define CHAT_ALL                    0
  25. #define CHAT_TEAM                    1
  26. #define CHAT_TELL                    2
  27.  
  28. //a console message
  29. typedef struct bot_consolemessage_s
  30. {
  31.     int handle;
  32.     float time;                                    //message time
  33.     int type;                                    //message type
  34.     char message[MAX_MESSAGE_SIZE];                //message
  35.     struct bot_consolemessage_s *prev, *next;    //prev and next in list
  36. } bot_consolemessage_t;
  37.  
  38. //match variable
  39. typedef struct bot_matchvariable_s
  40. {
  41.     char offset;
  42.     int length;
  43. } bot_matchvariable_t;
  44. //returned to AI when a match is found
  45. typedef struct bot_match_s
  46. {
  47.     char string[MAX_MESSAGE_SIZE];
  48.     int type;
  49.     int subtype;
  50.     bot_matchvariable_t variables[MAX_MATCHVARIABLES];
  51. } bot_match_t;
  52.  
  53. //setup the chat AI
  54. int BotSetupChatAI(void);
  55. //shutdown the chat AI
  56. void BotShutdownChatAI(void);
  57. //returns the handle to a newly allocated chat state
  58. int BotAllocChatState(void);
  59. //frees the chatstate
  60. void BotFreeChatState(int handle);
  61. //adds a console message to the chat state
  62. void BotQueueConsoleMessage(int chatstate, int type, char *message);
  63. //removes the console message from the chat state
  64. void BotRemoveConsoleMessage(int chatstate, int handle);
  65. //returns the next console message from the state
  66. int BotNextConsoleMessage(int chatstate, bot_consolemessage_t *cm);
  67. //returns the number of console messages currently stored in the state
  68. int BotNumConsoleMessages(int chatstate);
  69. //selects a chat message of the given type
  70. void BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
  71. //returns the number of initial chat messages of the given type
  72. int BotNumInitialChats(int chatstate, char *type);
  73. //find and select a reply for the given message
  74. int BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
  75. //returns the length of the currently selected chat message
  76. int BotChatLength(int chatstate);
  77. //enters the selected chat message
  78. void BotEnterChat(int chatstate, int clientto, int sendto);
  79. //get the chat message ready to be output
  80. void BotGetChatMessage(int chatstate, char *buf, int size);
  81. //checks if the first string contains the second one, returns index into first string or -1 if not found
  82. int StringContains(char *str1, char *str2, int casesensitive);
  83. //finds a match for the given string using the match templates
  84. int BotFindMatch(char *str, bot_match_t *match, unsigned long int context);
  85. //returns a variable from a match
  86. void BotMatchVariable(bot_match_t *match, int variable, char *buf, int size);
  87. //unify all the white spaces in the string
  88. void UnifyWhiteSpaces(char *string);
  89. //replace all the context related synonyms in the string
  90. void BotReplaceSynonyms(char *string, unsigned long int context);
  91. //loads a chat file for the chat state
  92. int BotLoadChatFile(int chatstate, char *chatfile, char *chatname);
  93. //store the gender of the bot in the chat state
  94. void BotSetChatGender(int chatstate, int gender);
  95. //store the bot name in the chat state
  96. void BotSetChatName(int chatstate, char *name, int client);
  97.  
  98.